#include<iostream>
using namespace std;
typedef long long LL;
const int N = 20;
LL arr[N];
LL n, m;
LL ans;
void dfs(int u)
{
	if (u >= n) {
		if (u == n) {
			ans++;
		}
		return;
	}
	for (int i = 0; i < m; i++) {
		dfs(arr[i] + u);
	}
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> arr[i];
	}
	dfs(0);
	cout << ans << endl;
	return 0;
}